/**
 * 寸金生产入库
 */
import request from '@/utils/httpRequest.js';
import axiosRequest from "@/utils/axiosRequest.js";

//获取生产订单状态数量
export function reqProductOrderStatusNum(){
    return request({
        url:"/workOrderComplete/menu/num",
        method:"get"
    })
}
//获取生产入库单列表
export function reqProductOrderList(parameter){
    request.$cancelRequest("/workOrderComplete/in/list");
    return request({
        cancelToken:new request.$CancelToken(function executor(cancel){
            request.$manageCancelTokenMap("/workOrderComplete/in/list",'save',cancel);
        }),
        url:"/workOrderComplete/in/list",
        method:"post",
        data:parameter
    })
}

//获取入库单详情
export function reqProductOrderDetail(productOrderId){
    return request({
        url:"/workOrderComplete/in/detail",
        method:"get",
        params:{
            id:productOrderId
        }
    })
}

//获取仓库列表信息
export function reqWarehouseList(){
    return request({
        url:"/workOrderComplete/warehouse/all",
        method:"get"
    })
}

//获取默认生产入库单号
export function reqDefaultProductInventoryCode(){
    return request({
        url:"/workOrderComplete/seCode",
        method:"get"
    })
}

//分页查询生产工单列表信息
export function reqProductWorkOrderList(parameter){
    return request({
        url:"/workOrderComplete/list",
        method:"post",
        data:{
            page:parameter.page,
            size:parameter.size,
            workOrderNumber:parameter.workOrderNumber,
            customFieldOne:parameter.customFieldOne
            // isShowMaterialFieldInfo:true
        }
    })
}

//生产工单详情
export function reqWorkOrderCompleteDetail(workOrderNumber){
    return request({
        url:"/workOrderComplete/detail",
        method:"get",
        params:{
            workOrderNumber
        }
    })
}

//分页查询生产订单列表信息
export function reqProductOrderCompleteList(parameter){
    return request({
        url:"/workOrderComplete/list2",
        method:"post",
        data:parameter
    })
}
//生产订单详情
export function reqProductOrderCompleteDetail(productOrderNumber){
    return request({
        url:"/workOrderComplete/detail2",
        method:"get",
        params:{
            productOrderNumber
        }
    })
}


//供应商列表信息
export function reqPurchaseSuppliers(){
    return request({
        url:"/purchaseReceipts/suppliers/list",
        method:"get",
        params:{
            page:1,
            size:100,
            code:"",
            name:""
        }
    })
}

//获取当前申请人
export function reqCurrentPerson(){
    return request({
        url:"/api/users/current",
        method:"get"
    })
}

//获取申请人列表信息
export function reqUserList(){
    return request({
        url:"/api/users/list",
        method:"get",
        params:{
            page:1,
            size:100,
            nickname:""
        }
    })
}





//创建并完成生产入库单
export function reqCreateProductOrder(parameter){
    return request({
        url:"/workOrderComplete/in/create",
        method:"post",
        data:parameter
    })
}
//创建生产入库单
export function reqProductOrderCreate(parameter){
    return request({
        url:"/workOrderComplete/create",
        method:"post",
        data:parameter
    })
}
//更新生产入库单
export function reqUpdateProductOrder(parameter){
    return request({
        url:"/workOrderComplete/update",
        method:"post",
        data:parameter
    })
}

//获取平台编码解析规则
export const reqScanCodeRuleInfo = (flagCode) => {
    if(!flagCode){
        flagCode = 'purchaseWarehousing.handleBarcodeScan.new';
    }
    return axiosRequest({
        url:"/wms/stocks/scan/code/rule/get",
        method:"post",
        data:{
            code:flagCode
        },
        headers:{
            'jun-path':1
        }
    })
}

//根据生产工单物料号获取批次号
export const reqBarcode = (relateNumber,materialCode) => {
    return request({
        url:"/workOrderComplete/barcode",
        method:"get",
        params:{
            relateNumber,
            materialCode
        }
    })
}

//获取标签模板接口
export const reqLabelTypes = () => {
    return request({
        url:"/labelTypes/rulesDetail2",
        method:"get",
        params:{
            ruleCode:'purchaseMaterialbarCode'
        }
    })
}

export const reqPrintLabelType = (parameter) => {
    return request({
        url:"/labelTypes/printLabel",
        method:"post",
        data:parameter
    })
}

export const reqPackageList = () => {
    return request({
        url:"/orderReports/teams/members/4",
        method:"get"
    })
}
export const reqInspectionList = () => {
    return request({
        url:"/orderReports/teams/members/5",
        method:"get"
    })
}
